﻿using FluentNHibernate.Mapping;
using IapService.Entity;

namespace IapService.Mappings
{
    public class InstanceMap : ClassMap<Instance>
    {
        public InstanceMap()
        {
            Not.LazyLoad();

            Id(x => x.Id);
            Map(x => x.Name);

            HasMany(x => x.Favorites)
                .Inverse()
                .Not.LazyLoad()
                .KeyColumn("instanceId")
                .AsBag()
                ;

            /*
            References(x => x.Report, "reportId").NotFound.Ignore();
            /*
            HasOne(x => x.Report)
                .Constrained()
                .ForeignKey("FK_ir_report")
                ;*/
        }
    }
}